<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计算题</title>
</head>
<body>
    <input type="text" value="" id="number1">
    <select id="operation">
        <option value="0"  selected="selected">请选择</option>
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text" id="number2" value="">
    <input type="button" value="=" id="btn">
    <input type="text" id="result">
    <script src="js/jquery-1.12.4.min.js"></script>
    <script>
         $(function () {
            var result;
            $("#btn").click(function () {
                // 获取运算符号
                var $oper = $("#operation>option:selected").text();
                // 获取操作数
                var val1 = parseFloat($("#number1").val());
                var val2 = parseFloat($("#number2").val());
                switch ($oper) {
                    case "请选择": 
                        alert("请选择运算方式"); 
                        break;
                    case "+": 
                        result = val1 + val2; 
                        break;
                    case "-": 
                        result = val1 - val2; 
                    break;
                    case "*": 
                        result = val1 * val2; 
                    break;
                    case "/": 
                        result = val1 / val2; 
                    break;
                }
                $("#result").val(result);
            })
        })
    </script>
</body>
</html>